package com.bw.controller;

import com.bw.bean.Vo;
import com.bw.bean.Vo6;
import com.bw.bean.Vo7;
import com.bw.bean.Vo8;
import com.bw.dao.OrderInfoDao;
import com.bw.service.OrderInfoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class OrderInfoController {

    @Autowired
    OrderInfoService orderInfoService;




    @RequestMapping("/findOrderInfo")
    public List<Map<String, Object>> findOrderInfo(){

        return orderInfoService.findOrderInfo();
    }


    //轮播表格
    @RequestMapping("/find6")
    public Map find6(){
        List<Map<String, Object>> list =orderInfoService.findOrderInfo();

        ArrayList<String> list1 = new ArrayList<>();

        list1.add("name");
        list1.add("gender");
        list1.add("totals");

        return   SugarUtil.getTablePlayData(list1,list);


    }


    //柱状图
    @RequestMapping("/find7")
    public Map find7(){

        List<Vo7> list=orderInfoService.find7();

        return   SugarUtil.getBarData(list);


    }


    @RequestMapping("/find8")
    public Map find8(){

        List<Vo8> list=orderInfoService.find8();

        return   SugarUtil.getPieData(list);


    }


    @RequestMapping("/find9")
    public Map find9(){

        List<Vo> voList=orderInfoService.find9();
        Map map =SugarUtil.getMapData(voList);

        return   map;


    }










}
